package reflect;

public class ArgDemo {
    public static void main(String[] args) {
        doSome(1,"a");
        doSome(1,"a","b","c","d","e");
        doSome(1,"a","b","c","d","e","a","b","c","d","e","a","b","c","d","e","a","b","c","d","e");
    }

    /**
     * 变才参数的语法:类名... 类名
     * 注意:变才参数怎么说方法的[最后一个]参数
     *
     * 变长参数是编译器认可的,编译后变长参数会被改为对应类型的数组:
     * public static void doSome(int a,String... s){.........}
     *
     * 调用时所有变长参数的实参会以一个数组形式传入
     * doSome(1,"a","b","c","d","e");--->doSome(1,new String[]{"a","b","c","d","e"});
     *
     *
     * @param a
     * @param s
     */
    public  static void doSome(int a,String... s){
        System.out.println(s.length);
    }
}
